import request from '@/config/axios'
import type { Dayjs } from 'dayjs';

/** 班级信息 */
export interface CourseClasses {
          id: number; // 授课管理主键
          classNumber: number; // 班级序号
          commodityId: string; // 商品ID
          studentQuantity: number; // 报名学生人数
          allCourseTime: number; // 课程总课时
          remainderCourseTime: number; // 剩余课时
  }

// 班级 API
export const CourseClassesApi = {
  // 查询班级分页
  getCourseClassesPage: async (params: any) => {
    return await request.get({ url: `/train/course-classes/page`, params })
  },

  // 查询全部班级
  getCourseClassesList: async (params: any) => {
    return await request.get({ url: `/train/course-classes/list`, params })
  },

  // 查询班级详情
  getCourseClasses: async (id: number) => {
    return await request.get({ url: `/train/course-classes/get?id=` + id })
  },

  // 新增班级
  createCourseClasses: async (data: CourseClasses) => {
    return await request.post({ url: `/train/course-classes/create`, data })
  },

  // 修改班级
  updateCourseClasses: async (data: CourseClasses) => {
    return await request.put({ url: `/train/course-classes/update`, data })
  },

  // 删除班级
  deleteCourseClasses: async (id: number) => {
    return await request.delete({ url: `/train/course-classes/delete?id=` + id })
  },

  /** 批量删除班级 */
  deleteCourseClassesList: async (ids: number[]) => {
    return await request.delete({ url: `/train/course-classes/delete-list?ids=${ids.join(',')}` })
  },

  // 导出班级 Excel
  exportCourseClasses: async (params) => {
    return await request.download({ url: `/train/course-classes/export-excel`, params })
  }
}
